using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TrackVision
{
    public partial class frmSettings : Form
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="frmSettings"/> class.
        /// </summary>
        public frmSettings()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Handles the Load event of the frmSettings control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void frmSettings_Load(object sender, EventArgs e)
        {
            comboSpeedUnits.Items.Clear();
            comboSpeedUnits.Items.Add("Kilometers Per Hour");
            comboSpeedUnits.Items.Add("Miles Per Hour");
            comboSpeedUnits.Items.Add("Knots (Nautical)");
            comboSpeedUnits.SelectedIndex = 0;
        }



        /// <summary>
        /// Handles the Click event of the btOk control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btOk_Click(object sender, EventArgs e)
        {
            switch(comboSpeedUnits.SelectedIndex)
            {
                case 1:
                    WriterSettings.GetInstance().SpeedUnits = SpeedUnits.MPH;
                    break;
                case 2:
                    WriterSettings.GetInstance().SpeedUnits = SpeedUnits.Knots;
                    break;
                default:
                    WriterSettings.GetInstance().SpeedUnits = SpeedUnits.KPH;
                    break;
            }

            this.Close();
        }
    }
}